The ValueIteratorReverse object contains the following methods:
The Initialize method initializes a value iterator reverse object.
Initialize(VhsSiteService As String, TagString As String, TimeStampEarliest As Date, TimeStampLatest As Date, IncludeDeleted As Long) As Long
| Parameter | Required | Description |
|---|---|---|
|
VhsSiteService |
Yes |
The site and service name of the VHS point tag, in "site.service" format. |
|
TagString |
Yes |
The point tag from which data is being retrieved in valid CygNet tag string format. |
|
TimeStampEarliest |
Yes |
The starting date of the retrieval period. Enter 0 for the date of the earliest timestamp. |
|
TimeStampLatest |
Yes |
The ending date of the retrieval period. Enter 0 for the date of the latest timestamp. |
|
IncludeDeleted |
Yes |
Indicates whether to include deleted records (1) or not (0). |
Returns a value based on whether the initialization was successful or not (1 = Success; 0 = Failure). The cursor is placed at the first (latest) value by default. Note that some timestamps outside the specified time period may be returned by the iterator if the value continues into the time period.
Example
The following subroutine demonstrates the use of the Initialize, MoveFirst, and GetForward methods of the ValueIteratorReverse Object. It displays the thirty most recent values (with timestamps) for a given point.
|
Sub DisplayRecentValues (tagString) Dim vhsValueIterRev, histEntry, counter lstValues.ResetContent counter = 0
Set vhsValueIterRev = CreateObject("CxVhsLib.ValueIteratorReverse") Set histEntry = CreateObject("CxVhsLib.HistoryEntryEx")
'Initialize value iterator vhsValueIterRev.Initialize "CYGDEMO.VHS", tagString, 0, 0, 0 vhsValueIterRev.MoveFirst
'Show all points in a list box While ((vhsValueIterRev.GetForward(histEntry)) And (counter < 30)) lstValues.AddString CStr(histEntry.TimeStamp) & " "_ & CStr(histEntry.Value) counter = counter + 1 Wend End Sub |
The GetBackward method retrieves information about the previous value in the iteration list. Returns a HistoryEntryEx object in the pVal variable.
GetBackward(pVal As Variant) As Long
| Parameter | Required | Description |
|---|---|---|
|
pVal |
Yes |
Returns the site, service, Short Point ID, Long Point ID, and tag string for a point in the VHS. Type: HistoryEntryEx |
The GetBackward function retrieves information for a value and moves the cursor backward to the previous value. The return value is 1 while there are still values in the list. When TimeStampLatest (as specified during initialization) or the end of the list is reached, 0 is returned.
Example
The following subroutine demonstrates the use of the Initialize, MoveLast, and GetBackward methods of the ValueIteratorReverse Object. It displays all values during June of 2004 for a given point.
|
Sub DisplayJuneValues (tagString) Dim vhsValueIterRev, histEntry lstValues.ResetContent
Set vhsValueIterRev = CreateObject("CxVhsLib.ValueIteratorReverse") Set histEntry = CreateObject("CxVhsLib.HistoryEntryEx")
'Initialize value iterator vhsValueIterRev.Initialize "CYGDEMO.VHS", tagString, "6/1/04",_ "6/30/04 23:59:59", 0 vhsValueIterRev.MoveLast
'Show all points in a list box While (vhsValueIterRev.GetBackward(histEntry)) lstValues.AddString CStr(histEntry.TimeStamp) & " "_ & CStr(histEntry.Value) Wend End Sub |
The GetBackwardEx method retrieves information about the previous value in the iteration list. Returns a ValueEntryEx object in the pVal variable.
GetBackwardEx(pVal As Variant) As Long
| Parameter | Required | Description |
|---|---|---|
|
pVal |
Yes |
Returns the timestamp, status, user status, value, time ordinal, and rollup information for the value entry. Type: ValueEntryEx |
The GetBackwardEx function retrieves information for a value and moves the cursor backward to the previous value. The return value is 1 while there are still values in the list. When TimeStampLatest (as specified during initialization) or the end of the list is reached, 0 is returned.
Example
The following subroutine demonstrates the use of the Initialize, MoveLast, and GetBackwardEx methods of the ValueIteratorReverse Object. It displays all values during June of 2004 for a given point.
|
Sub DisplayJuneValues (tagString) Dim vhsValueIterRev, valueEntry lstValues.ResetContent
Set vhsValueIterRev = CreateObject("CxVhsLib.ValueIteratorReverse") Set valueEntry = CreateObject("CxVhsLib.ValueEntryEx")
'Initialize value iterator vhsValueIterRev.Initialize "CYGDEMO.VHS", tagString, "6/1/04",_ "6/30/04 23:59:59", 0 vhsValueIterRev.MoveLast
'Show all points in a list box While (vhsValueIterRev.GetBackwardEx(valueEntry)) lstValues.AddString CStr(valueEntry.TimeStamp) & " "_ & CStr(valueEntry.Value) Wend End Sub |
The GetForward method retrieves information about the next value in the iteration list. Returns a HistoryEntryEx object in the pVal variable.
GetForward(pVal As Variant) As Long
| Parameter | Required | Description |
|---|---|---|
|
pVal |
Yes |
Required. Returns the timestamp, status, user status, and value of a record. Type: HistoryEntryEx |
The GetForward function retrieves information for the next value and moves the cursor forward to the value. The return value is 1 while there are still values in the list. When TimeStampEarliest (as specified during initialization) or the end of the list is reached, 0 is returned.
Example
The following subroutine demonstrates the use of the Initialize, MoveFirst, and GetForward methods of the ValueIteratorReverse Object. It displays the thirty most recent values (with timestamps) for a given point.
|
Sub DisplayRecentValues (tagString) Dim vhsValueIterRev, histEntry, counter lstValues.ResetContent counter = 0
Set vhsValueIterRev = CreateObject("CxVhsLib.ValueIteratorReverse") Set histEntry = CreateObject("CxVhsLib.HistoryEntryEx")
'Initialize value iterator vhsValueIterRev.Initialize "CYGDEMO.VHS", tagString, 0, 0, 0 vhsValueIterRev.MoveFirst
'Show all points in a list box While ((vhsValueIterRev.GetForward(histEntry)) And (counter < 30)) lstValues.AddString CStr(histEntry.TimeStamp) & " "_ & CStr(histEntry.Value) counter = counter + 1 Wend End Sub |
The GetForwardEx method retrieves information about the next value in the iteration list. Returns a ValueEntryEx object in the pVal variable.
GetForwardEx(pVal As Variant) As Long
| Parameter | Required | Description |
|---|---|---|
|
pVal |
Yes |
Required. Returns the timestamp, status, user status, value, time ordinal, and rollup information for the value entry. Type: ValueEntryEx |
The GetForwardEx function retrieves information for the next value and moves the cursor forward to the value. The return value is 1 while there are still values in the list. When TimeStampEarliest (as specified during initialization) or the end of the list is reached, 0 is returned.
Example
The following subroutine demonstrates the use of the Initialize, MoveFirst, and GetForwardEx methods of the ValueIteratorReverse Object. It displays the thirty most recent values (with timestamps) for a given point.
|
Sub DisplayRecentValues (tagString) Dim vhsValueIterRev, valueEntry, counter lstValues.ResetContent counter = 0
Set vhsValueIterRev = CreateObject("CxVhsLib.ValueIteratorReverse") Set valueEntry = CreateObject("CxVhsLib.ValueEntryEx")
'Initialize value iterator vhsValueIterRev.Initialize "CYGDEMO.VHS", tagString, 0, 0, 0 vhsValueIterRev.MoveFirst
'Show all points in a list box While ((vhsValueIterRev.GetForwardEx(valueEntry)) And (counter < 30)) lstValues.AddString CStr(valueEntry.TimeStamp) & " "_ & CStr(valueEntry.Value) counter = counter + 1 Wend End Sub |
The MoveFirst method moves to the first value in the iteration list.
MoveFirst() As Long
Returns a value based on whether the method was successful or not (1 = Success; 0 = Failure).
Example
The following subroutine demonstrates the use of the Initialize, MoveFirst, and GetForward methods of the ValueIteratorReverse Object. It displays the thirty most recent values (with timestamps) for a given point.
|
Sub DisplayRecentValues (tagString) Dim vhsValueIterRev, histEntry, counter lstValues.ResetContent counter = 0
Set vhsValueIterRev = CreateObject("CxVhsLib.ValueIteratorReverse") Set histEntry = CreateObject("CxVhsLib.HistoryEntryEx")
'Initialize value iterator vhsValueIterRev.Initialize "CYGDEMO.VHS", tagString, 0, 0, 0 vhsValueIterRev.MoveFirst
'Show all points in a list box While ((vhsValueIterRev.GetForward(histEntry)) And (counter < 30)) lstValues.AddString CStr(histEntry.TimeStamp) & " "_ & CStr(histEntry.Value) counter = counter + 1 Wend End Sub |
The MoveLast method moves to the last value in the iteration list.
MoveLast() As Long
Returns a value based on whether the method was successful or not (1 = Success; 0 = Failure).
Example
The following subroutine demonstrates the use of the Initialize, MoveLast, and GetBackward methods of the ValueIteratorReverse Object. It displays all values during June of 2004 for a given point.
|
Sub DisplayJuneValues (tagString) Dim vhsValueIterRev, histEntry lstValues.ResetContent
Set vhsValueIterRev = CreateObject("CxVhsLib.ValueIteratorReverse") Set histEntry = CreateObject("CxVhsLib.HistoryEntryEx")
'Initialize value iterator vhsValueIterRev.Initialize "CYGDEMO.VHS", tagString, "6/1/04",_ "6/30/04 23:59:59", 0 vhsValueIterRev.MoveLast
'Show all points in a list box While (vhsValueIterRev.GetBackward(histEntry)) lstValues.AddString CStr(histEntry.TimeStamp) & " "_ & CStr(histEntry.Value) Wend End Sub |